-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update go-multiaddr to v0.11.0 #2467
Conversation
221ef01
to
16084b0
Compare
slices.SortFunc(s, func(first, second *observedAddr) bool { | ||
if first.numInbound > second.numInbound { | ||
return true | ||
slices.SortFunc(s, func(first, second *observedAddr) int { | ||
if first.numInbound > second.numInbound || len(first.seenBy) > len(second.seenBy) { | ||
return -1 | ||
} | ||
return len(first.seenBy) > len(second.seenBy) | ||
return 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the logic carefully.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm.
if first.numInbound > second.numInbound { | ||
return true | ||
slices.SortFunc(s, func(first, second *observedAddr) int { | ||
if first.numInbound > second.numInbound || len(first.seenBy) > len(second.seenBy) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old behavior is still here, and the new behavior seems reasonable. Should we update the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old behavior is still here, and the new behavior seems reasonable.
What do you mean? I didn't mean to change the behavior. Did I mess up the logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new code is strictly equivalent.
slices.SortFunc(s, func(first, second *observedAddr) bool { | ||
if first.numInbound > second.numInbound { | ||
return true | ||
slices.SortFunc(s, func(first, second *observedAddr) int { | ||
if first.numInbound > second.numInbound || len(first.seenBy) > len(second.seenBy) { | ||
return -1 | ||
} | ||
return len(first.seenBy) > len(second.seenBy) | ||
return 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm.
Will this change be included in |
That’s not possible according to semver rules. |
Then I'll guess we have to wait for |
This is getting in two important changes in go-multiaddr that many users have been complaining about (see release notes).